
cmake_minimum_required(VERSION 2.6)

project(avs-toyhttpd)

set(HEADERS
		src/configuration.h
		src/request.h
		src/server.h
		src/content.h
		src/plaincontent.h
		src/htmlcontent.h
		src/phpcontent.h
		src/cgicontent.h
		src/othercontent.h
		src/dispatcher.h
)

set(SOURCES
		src/configuration.cpp
		src/request.cpp
		src/server.cpp
		src/plaincontent.cpp
		src/htmlcontent.cpp
		src/phpcontent.cpp
		src/cgicontent.cpp
		src/othercontent.cpp
		src/dispatcher.cpp
		src/main.cpp
)

find_package (Threads)

find_path(LIBCONFIG_DEV
			libconfig.h++
			/usr/local/include
			/usr/include
)

find_library(LIBCONFIG
				config++
				/usr/local/lib
				/usr/lib
)

find_path(LIBEVENT_DEV
			event.h
			/usr/local/include/event2
			/usr/include/event2
)

find_library(LIBEVENT
				event
				/usr/local/lib
				/usr/lib
)

find_path(LIBMAGIC_DEV
			magic.h
			/usr/local/include
			/usr/include
)

find_library(LIBMAGIC
				magic
				/usr/local/lib
				/usr/lib
)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")

add_executable(toyhttpd ${HEADERS} ${SOURCES})
target_link_libraries(toyhttpd ${LIBCONFIG} ${LIBEVENT} ${LIBMAGIC} pthread)

